package com.blogs.tools;

import android.app.Activity;
import android.util.DisplayMetrics;
import android.util.Log;

public class Screen {
	private int screenWidth=0;
	private int screenHeight=0;
	public Screen(Activity context)
	{
		screenWidth=getScreenSize(context).widthPixels;
		screenHeight=getScreenSize(context).heightPixels;
	}
	/*
	 * 获取屏幕大小
	 * */
	private DisplayMetrics getScreenSize(Activity context)
	{
		DisplayMetrics dm;
		dm=new DisplayMetrics();
		context.getWindowManager().getDefaultDisplay().getMetrics(dm);
		Log.i("Sense", dm.widthPixels+"*"+dm.heightPixels);
		return dm;
	}
	/*
	 * 返回屏幕宽度
	 * */
	public int getScreenWidth()
	{
		return screenWidth;
	}
	public int getScreenHeight()
	{
		return screenHeight;
	}
}
